*Load and declare as time series
use "CRSg7frame.dta", clear
xtset policyArea_num year
*drop 4 G7RG categories don't use
drop if PolicyArea == "East-West (Russia)" | PolicyArea == "IFI/UN reform" | PolicyArea == "International cooperation" | PolicyArea == "Development"
*************************************************************************************************************************
*Figure 2: Annual Variation in Commitment Dummy by Policy Area (30 boxes)
set scheme s1mono
grstyle init
grstyle set plain, nogrid
*Commit Count Version
twoway connected NoOfG7Commits year, by(PolicyArea, note ("")) ///
	ytitle("Number of Commitments") ytitle(, size(small)) ///
	xtitle("") xtitle(, size(small)) xlabel(1975(15)2021)

*************************************************************************************************************************
*Table 2 (Spend)
*Model 1 (Correlation)
reghdfe deltaCommitSpend CommitNoIncreaseDummy ///
, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model1
*Model 2 (Add Controls)
reghdfe deltaCommitSpend CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model2
*Model 3 (All Controls)
reghdfe deltaCommitSpend CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model3
*Table
esttab Model1 Model2 Model3 using Tab2_SpendMain.csv, replace /// 
varlabels("CommitNoIncreaseDummy" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
title("Table 2: Estimating the G7 Effect on Aid Spending") /// 
note("Country and Year fixed effects" "Standard Errors Robust to Unit Clustering")

*************************************************************************************************************************
*Table 3 and Figure 3 (Spend placebos)
*Model 4 (1 lead and lag)
reghdfe deltaCommitSpend l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model4
*Model 5 (2 deep leads and lags)
reghdfe deltaCommitSpend l2.CommitNoIncreaseDummy l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy f2.CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model5
*Model 6 (3 deep leads and lags)
reghdfe deltaCommitSpend l3.CommitNoIncreaseDummy l2.CommitNoIncreaseDummy l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy f2.CommitNoIncreaseDummy f3.CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model6

*Table
esttab Model4 Model5 Model6 using Tab3_SpendPlacebos.csv, replace /// 
varlabels("CommitNoIncreaseDummy" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
note("Country and Year fixed effects" "Standard Errors Robust to Unit Clustering")


*Figure 3 (Placebo AMEs)
*Label coefs/vars for coefplot
label variable CommitNoIncreaseDummy "G7Commit" 
coefplot Model4 Model5 Model6, keep(*CommitNoIncreaseDummy l.CommitNoIncreaseDummy f.CommitNoIncreaseDummy l2.CommitNoIncreaseDummy f2.CommitNoIncreaseDummy l3.CommitNoIncreaseDummy f3.CommitNoIncreaseDummy) ///
order(l3.CommitNoIncreaseDummy l2.CommitNoIncreaseDummy l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy f2.CommitNoIncreaseDummy f3.CommitNoIncreaseDummy) ///
coeflabels(L.CommitNoIncreaseDummy = "G7Commit_t-1" F.CommitNoIncreaseDummy = "G7Commit_t+1" L2.CommitNoIncreaseDummy = "G7Commit_t-2" F2.CommitNoIncreaseDummy = "G7Commit_t+2" L3.CommitNoIncreaseDummy = "G7Commit_t-3" F3.CommitNoIncreaseDummy = "G7Commit_t+3") ///
xline(0, lc(black)) mcolor(mono) legend(size(small) rows(1)) levels(90) ///
title("Fig. 3: Table 3 G7Commit Lead/Lag Placebo Tests", size(mediumsmall)) note("90% confidence intervals")

*************************************************************************************************************************
*Table 4 (Trust Funds)
*Model 7 (Correlation)
ppmlhdfe AllNewTFs_ThisArea CommitNoIncreaseDummy ///
, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model7
*Model 8 (Add Controls)
ppmlhdfe AllNewTFs_ThisArea CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model8
*Model 9 (All Controls)
ppmlhdfe AllNewTFs_ThisArea CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model9
*Table
esttab Model7 Model8 Model9 using Tab4_TFMain.csv, replace /// 
varlabels("CommitNoIncreaseDummy" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
title("Table 4: Estimating the G7 Effect on Trsut Funds") /// 
note("Country and Year fixed effects" "Standard Errors Robust to Unit Clustering")

*************************************************************************************************************************
*Table 5 and Figure 4 (TFund placebos)
*Model 10 (1 lead and lag)
ppmlhdfe AllNewTFs_ThisArea l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model10
*Model 11 (2 leads and lags)
ppmlhdfe AllNewTFs_ThisArea l2.CommitNoIncreaseDummy l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy f2.CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model11
*Model 12 (3 leads and lags)
ppmlhdfe AllNewTFs_ThisArea l3.CommitNoIncreaseDummy l2.CommitNoIncreaseDummy l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy f2.CommitNoIncreaseDummy f3.CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model12
*Table
esttab Model10 Model11 Model12 using Tab5_TFMain_Placebos.csv, replace /// 
varlabels("CommitNoIncreaseDummy" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
title("Table 5: Estimating the G7 Effect on Trsut Funds") /// 
note("Country and Year fixed effects" "Standard Errors Robust to Unit Clustering")


*Figure 4 (Placebo AMEs)
coefplot Model10 Model11 Model12, keep(*CommitNoIncreaseDummy l.CommitNoIncreaseDummy f.CommitNoIncreaseDummy l2.CommitNoIncreaseDummy f2.CommitNoIncreaseDummy l3.CommitNoIncreaseDummy f3.CommitNoIncreaseDummy) ///
order(l3.CommitNoIncreaseDummy l2.CommitNoIncreaseDummy l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy f2.CommitNoIncreaseDummy f3.CommitNoIncreaseDummy) ///
coeflabels(L.CommitNoIncreaseDummy = "G7Commit_t-1" F.CommitNoIncreaseDummy = "G7Commit_t+1" L2.CommitNoIncreaseDummy = "G7Commit_t-2" F2.CommitNoIncreaseDummy = "G7Commit_t+2" L3.CommitNoIncreaseDummy = "G7Commit_t-3" F3.CommitNoIncreaseDummy = "G7Commit_t+3") ///
xline(0, lc(black)) mcolor(mono) legend(size(small) rows(1)) levels(90) ///
title("Fig. 4: Table 5 G7Commit Lead/Lag Placebo Tests", size(mediumsmall)) note("90% confidence intervals")

*************************************************************************************************************************
* Appendix A (Descriptives)
tabstat CRSspendOnG7Commit deltaCommitSpend SpendDV_minusHost deltaSpendNoHost AllNewTFs_ThisArea CommitNoIncreaseDummy cumsumTFsInThisArea, stat(n mean mi ma sd) case col(stat)

*************************************************************************************************************************
* Appendix C (1990-2021 Sample)
*Drop pre 1990
drop if year < 1990

* App C Table 1
*Model 1 (Correlation)
reghdfe deltaCommitSpend CommitNoIncreaseDummy ///
, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model1
*Model 2 (Add Controls)
reghdfe deltaCommitSpend CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model2
*Model 3 (All Controls)
reghdfe deltaCommitSpend CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model3
*Table
esttab Model1 Model2 Model3 using Spend_19902021only.csv, replace /// 
varlabels("CommitNoIncreaseDummy" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
title("1990-2021 Spending") /// 
note("Country and Year fixed effects" "Standard Errors Robust to Unit Clustering")

* App C Table 3 (Spend placebos)
* 1 lead and lag
reghdfe deltaCommitSpend l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model4
* 2 leads and lags
reghdfe deltaCommitSpend l2.CommitNoIncreaseDummy l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy f2.CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model5
* 3 leads and lags
reghdfe deltaCommitSpend l3.CommitNoIncreaseDummy l2.CommitNoIncreaseDummy l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy f2.CommitNoIncreaseDummy f3.CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model6
*Table
esttab Model4 Model5 Model6 using SpendPlacebos_19902021only.csv, replace /// 
varlabels("CommitNoIncreaseDummy" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
title("1990-2021 Spending Placebos") /// 
note("Country and Year fixed effects" "Standard Errors Robust to Unit Clustering")

* App C Table 2 (TFs)
*Model 7 (Correlation)
ppmlhdfe AllNewTFs_ThisArea CommitNoIncreaseDummy ///
, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model7
*Model 8 (Add Controls)
ppmlhdfe AllNewTFs_ThisArea CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model8
*Model 9 (All Controls)
ppmlhdfe AllNewTFs_ThisArea CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model9
*Table
esttab Model7 Model8 Model9 using TF_19902021only.csv, replace /// 
varlabels("CommitNoIncreaseDummy" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
title("1990-2021 Spending") /// 
note("Country and Year fixed effects" "Standard Errors Robust to Unit Clustering")


* App C Table 4 (TF placebos)
* Model 10 (1 lead and lag)
ppmlhdfe AllNewTFs_ThisArea l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model10
* Model 11 (2 leads and lags)
ppmlhdfe AllNewTFs_ThisArea l2.CommitNoIncreaseDummy l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy f2.CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model11
* Model 12 (3 leads and lags)
ppmlhdfe AllNewTFs_ThisArea l3.CommitNoIncreaseDummy l2.CommitNoIncreaseDummy l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy f2.CommitNoIncreaseDummy f3.CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model12
*Table
esttab Model10 Model11 Model12 using TFPlacebos_19902021only.csv, replace /// 
varlabels("CommitNoIncreaseDummy" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
title("1990-2021 Spending Placebos") /// 
note("Country and Year fixed effects" "Standard Errors Robust to Unit Clustering")

*************************************************************************************************************************
* Appendix D (Other Spend DVs)
* Reload full data after dropping pre-1990 observations
use "CRSg7frame.dta", clear
xtset policyArea_num year
*drop 4 G7RG categories don't use
drop if PolicyArea == "East-West (Russia)" | PolicyArea == "IFI/UN reform" | PolicyArea == "International cooperation" | PolicyArea == "Development"

*App D Part i
reghdfe deltaNONG7ONLYspend CommitNoIncreaseDummy ///
, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Modela10
* a la Model 2 (Add Controls)
reghdfe deltaNONG7ONLYspend CommitNoIncreaseDummy ///
l.deltaNONG7ONLYspend l.AllNewTFs_ThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Modela11
* a la Model 3 (All Controls)
reghdfe deltaNONG7ONLYspend CommitNoIncreaseDummy ///
l.deltaNONG7ONLYspend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Modela12
*Table
esttab Modela10 Modela11 Modela12 using TabA4_nonG&SpendOnly.csv, replace /// 
varlabels("CommitNoIncreaseDummy" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
note("Country and Year fixed effects" "Standard Errors Robust to Unit Clustering")

* App D Part ii (Delta bilateral spend only)
* a la Model 1 (Correlation)
reghdfe deltaSpendBilatOnly CommitNoIncreaseDummy ///
, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Modela4
* a la Model 2 (Add Controls)
reghdfe deltaSpendBilatOnly CommitNoIncreaseDummy ///
l.deltaSpendBilatOnly l.AllNewTFs_ThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Modela5
* a la Model 3 (All Controls)
reghdfe deltaSpendBilatOnly CommitNoIncreaseDummy ///
l.deltaSpendBilatOnly l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Modela6
*Table
esttab Modela4 Modela5 Modela6 using TabA2_bilatSpendOnly.csv, replace /// 
varlabels("CommitNoIncreaseDummy" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
note("Country and Year fixed effects" "Standard Errors Robust to Unit Clustering")

* Delta bilateral spend only, but lagged
* a la Model 1 (Correlation)
reghdfe deltaSpendBilatOnly l.CommitNoIncreaseDummy ///
, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Modela7
* a la Model 2 (Add Controls)
reghdfe deltaSpendBilatOnly l.CommitNoIncreaseDummy ///
l.deltaSpendBilatOnly l.AllNewTFs_ThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Modela8
* a la Model 3 (All Controls)
reghdfe deltaSpendBilatOnly l.CommitNoIncreaseDummy ///
l.deltaSpendBilatOnly l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Modela9
*Table
esttab Modela7 Modela8 Modela9 using TabA3_bilatSpendOnly_LagG7.csv, replace /// 
varlabels("CommitNoIncreaseDummy" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
note("Country and Year fixed effects" "Standard Errors Robust to Unit Clustering")

*************************************************************************************************************************
*Appendix E (No lagged DV)
*a la Model 2 (Add Controls)
reghdfe deltaCommitSpend CommitNoIncreaseDummy ///
l.AllNewTFs_ThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Modela13
*a la Model 3 (All Controls)
reghdfe deltaCommitSpend CommitNoIncreaseDummy ///
l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Modela14
*a la Model 8 (Add Controls)
ppmlhdfe AllNewTFs_ThisArea CommitNoIncreaseDummy ///
l.deltaCommitSpend, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Modela15
*a la Model 9 (All Controls)
ppmlhdfe AllNewTFs_ThisArea CommitNoIncreaseDummy ///
l.deltaCommitSpend l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Modela16
*Table
esttab Modela13 Modela14 Modela15 Modela16 using TabA5_NoLaggedDVmodels.csv, replace /// 
varlabels("CommitNoIncreaseDummy" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
note("Country and Year fixed effects" "Standard Errors Robust to Unit Clustering")

*************************************************************************************************************************
*Appendix F
*Appendix Fi (Change in Commitment #)
*Spend and TF Basic (Models 3 and 9)
regress deltaCommitSpend CommitNoIncreaseDummy l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea deltaTotalAnnCommits i.policyArea_num, cluster(policyArea_num)
estimates store Modela17
regress AllNewTFs_ThisArea CommitNoIncreaseDummy l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea deltaTotalAnnCommits i.policyArea_num, cluster(policyArea_num)
estimates store Modela18
*Spend and TF Placebos (Models 6 and 12)
regress deltaCommitSpend l3.CommitNoIncreaseDummy l2.CommitNoIncreaseDummy l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy f2.CommitNoIncreaseDummy f3.CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea deltaTotalAnnCommits i.policyArea_num, cluster(policyArea_num)
estimates store Modela19
regress AllNewTFs_ThisArea l3.CommitNoIncreaseDummy l2.CommitNoIncreaseDummy l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy f2.CommitNoIncreaseDummy f3.CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea deltaTotalAnnCommits i.policyArea_num, cluster(policyArea_num)
estimates store Modela20
*Table
esttab Modela17 Modela18 Modela19 Modela20 using TabA11_ChangeTotG7commits.csv, replace /// 
varlabels("CommitNoIncreaseDummy" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
note("Unit fixed effects" "Standard Errors Robust to Unit Clustering")
*Appendix Fii (Control for # of dev commits)
regress deltaCommitSpend CommitNoIncreaseDummy l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea deltaDevCommitNumberThisYr i.policyArea_num, cluster(policyArea_num)
estimates store Modela21
regress AllNewTFs_ThisArea CommitNoIncreaseDummy l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea deltaDevCommitNumberThisYr i.policyArea_num, cluster(policyArea_num)
estimates store Modela22
*Spend and TF Placebos (Models 6 and 12)
regress deltaCommitSpend l3.CommitNoIncreaseDummy l2.CommitNoIncreaseDummy l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy f2.CommitNoIncreaseDummy f3.CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea deltaDevCommitNumberThisYr i.policyArea_num, cluster(policyArea_num)
estimates store Modela23
regress AllNewTFs_ThisArea l3.CommitNoIncreaseDummy l2.CommitNoIncreaseDummy l.CommitNoIncreaseDummy CommitNoIncreaseDummy f.CommitNoIncreaseDummy f2.CommitNoIncreaseDummy f3.CommitNoIncreaseDummy ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea deltaDevCommitNumberThisYr i.policyArea_num, cluster(policyArea_num)
estimates store Modela24
*Table
esttab Modela21 Modela22 Modela23 Modela24 using TabA12_CtlDeltaDevCommits.csv, replace /// 
varlabels("CommitNoIncreaseDummy" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
note("Unit fixed effects" "Standard Errors Robust to Unit Clustering")

*************************************************************************************************************************
*Appendix G
fracreg probit PerCRSspend l3.PerAnnCommits l2.PerAnnCommits l.PerAnnCommits PerAnnCommits f.PerAnnCommits f2.PerAnnCommits f3.PerAnnCommits ///
l.PerCRSspend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea i.year, vce(cluster policyArea_num)
estimates store PerApp1
fracreg probit PerCRSspend l3.deltaPerAnnCommits l2.deltaPerAnnCommits l.deltaPerAnnCommits deltaPerAnnCommits f.deltaPerAnnCommits f2.deltaPerAnnCommits f3.deltaPerAnnCommits ///
l.PerCRSspend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea i.year, vce(cluster policyArea_num)
estimates store PerApp2
*Make non G7 % Var & Test
gen nonG7spendPerCRS = nonG7spend/TotalCRSAnnualSpend
fracreg probit nonG7spendPerCRS l3.PerAnnCommits l2.PerAnnCommits l.PerAnnCommits PerAnnCommits f.PerAnnCommits f2.PerAnnCommits f3.PerAnnCommits ///
l.nonG7spendPerCRS l.AllNewTFs_ThisArea l.cumsumTFsInThisArea i.year, vce(cluster policyArea_num)
estimates store PerApp3
fracreg probit nonG7spendPerCRS l3.deltaPerAnnCommits l2.deltaPerAnnCommits l.deltaPerAnnCommits deltaPerAnnCommits f.deltaPerAnnCommits f2.deltaPerAnnCommits f3.deltaPerAnnCommits ///
l.nonG7spendPerCRS l.AllNewTFs_ThisArea l.cumsumTFsInThisArea i.year, vce(cluster policyArea_num)
estimates store PerApp4
**TFs
gen TFsThisArea_PerTotalTFs = AllNewTFs_ThisArea/NewTFs_Total
fracreg probit TFsThisArea_PerTotalTFs l3.PerAnnCommits l2.PerAnnCommits l.PerAnnCommits PerAnnCommits f.PerAnnCommits f2.PerAnnCommits f3.PerAnnCommits ///
l.PerCRSspend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea i.year, vce(cluster policyArea_num)
estimates store PerApp5
fracreg probit TFsThisArea_PerTotalTFs l3.deltaPerAnnCommits l2.deltaPerAnnCommits l.deltaPerAnnCommits deltaPerAnnCommits f.deltaPerAnnCommits f2.deltaPerAnnCommits f3.deltaPerAnnCommits ///
l.PerCRSspend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea i.year, vce(cluster policyArea_num)
estimates store PerApp6
*Table
esttab PerApp1 PerApp2 PerApp3 PerApp4 PerApp5 PerApp6 using TabA6_PercentVars.csv, replace /// 
varlabels("deltaPerAnnCommits" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
title("Percentage Measures") /// 
note("Year fixed effects" "Standard Errors Robust to Unit Clustering")

*************************************************************************************************************************
*Appendix H (IPOD vars)
*Only keep IPOD years (1980-2015)
drop if year < 1980
drop if year > 2015
*Spend
*Model 1 (Correlation)
reghdfe deltaCommitSpend CommitNoIncreaseDummy IPODareaCount ///
, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model1
*Model 2 (Add Controls)
reghdfe deltaCommitSpend CommitNoIncreaseDummy IPODareaCount ///
l.deltaCommitSpend l.AllNewTFs_ThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model2
*Model 3 (All Controls)
reghdfe deltaCommitSpend CommitNoIncreaseDummy IPODareaCount ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model3
*Table
esttab Model1 Model2 Model3 using TabA7_IPODspend.csv, replace /// 
varlabels("CommitNoIncreaseDummy" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
title("Spend models with IPOD") /// 
note("Country and Year fixed effects" "Standard Errors Robust to Unit Clustering")
*TFs
*Model 7 (Correlation)
ppmlhdfe AllNewTFs_ThisArea CommitNoIncreaseDummy IPODareaCount ///
, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model7
*Model 8 (Add Controls)
ppmlhdfe AllNewTFs_ThisArea CommitNoIncreaseDummy IPODareaCount ///
l.deltaCommitSpend l.AllNewTFs_ThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model8
*Model 9 (All Controls)
ppmlhdfe AllNewTFs_ThisArea CommitNoIncreaseDummy IPODareaCount ///
l.deltaCommitSpend l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model9
*Table
esttab Model7 Model8 Model9 using TabA9_IPODtfs.csv, replace /// 
varlabels("CommitNoIncreaseDummy" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
title("IPOD Controls in Trust Fund Models") /// 
note("Country and Year fixed effects" "Standard Errors Robust to Unit Clustering")

*************************************************************************************************************************
*Appendix I
* Reload full data after dropping non-IPOD observations
use "CRSg7frame.dta", clear
xtset policyArea_num year
*drop 4 G7RG categories don't use
drop if PolicyArea == "East-West (Russia)" | PolicyArea == "IFI/UN reform" | PolicyArea == "International cooperation" | PolicyArea == "Development"
*Correlation, IV
ivreghdfe deltaSpendNoHost (CommitNoIncreaseDummy=USDsumHostSpend_byG7commit) ///
, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model4
*Add Controls, IV
ivreghdfe deltaSpendNoHost (CommitNoIncreaseDummy=USDsumHostSpend_byG7commit) ///
l.deltaSpendNoHost l.AllNewTFs_ThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model5
*All Controls, IV
ivreghdfe deltaSpendNoHost (CommitNoIncreaseDummy=USDsumHostSpend_byG7commit) ///
l.deltaSpendNoHost l.AllNewTFs_ThisArea l.cumsumTFsInThisArea, absorb(policyArea_num year) cluster(policyArea_num)
estimates store Model6
*Table
esttab Model4 Model5 Model6 using SpendIV.csv, replace /// 
varlabels("CommitNoIncreaseDummy" "G7Commit" "l.deltaSpendNoHost" "deltaSpend_lag" "l.AllNewTFs_ThisArea" "NewTFs_lag" "l.cumsumTFsInThisArea" "TFsEver_lag" ) ///
cells(b(star fmt(%9.3f)) se(par)) stats(N) starlevels(* 0.10 ** 0.05 *** 0.01) nonumbers legend /// 
title("Estimating the G7 Effect on Aid Spending") /// 
note("Country and Year fixed effects" "Standard Errors Robust to Unit Clustering")

